package com.example.ibsp_demo.controller.create;

import com.example.ibsp_demo.pojo.entity.content.Partition;
import com.example.ibsp_demo.pojo.response.ResponseMessage;
import com.example.ibsp_demo.service.content.PartitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/partition")
public class PartitionController {

    @Autowired
    private PartitionService partitionService;

    /**
     * 获取所有分区（按排序权重）
     */
    @GetMapping("/all")
    public ResponseMessage<List<Partition>> getAllPartitions() {
        List<Partition> partitions = partitionService.selectAllOrderedBySort();
        return ResponseMessage.success(partitions);
    }
}
